/* Copyright (c) 2009 SpringShowcase, Inc.
 * All right reserved.
 * http://code.google.com/p/springshowcase/
 * This software is the confidential and proprietary information of BeyondWeb
 * , Inc. You shall not disclose such Confidential Information and
 * shall use it only in accordance with the terms of the license agreement
 * you entered into with BeyondWeb.
 *
 * Revision History
 * Author              Date             Description
 * ------------------   --------------    ------------------
 *  taeki.kim           2010. 4. 2.        
*/
package org.springshowcase.core.commons.utils;

import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * File을 보다 쉽게 처리 하기 위한 유틸리티
 * 
 * 기본 적으로 org.apache.commons.io.FileUtils 를 상속 받아서 부모의 메서드를 사용 할 수 있다.
 * 
 * @author kim.tae.ki
 * @version
 * @see
 * 
 * This file contains the declarations of String class and its helper classes.
 */
public class FilesUtils extends FileUtils{

    // ---------------------------------------------------------------------
    // Class Variable Declaration
    // ---------------------------------------------------------------------
    
    /** 클래스에서 사용하는 로거. */
	private static final Logger logger = LoggerFactory
	.getLogger(FilesUtils.class);
	
	// ---------------------------------------------------------------------
    // Constructor Method Declaration
    // ---------------------------------------------------------------------
	// ---------------------------------------------------------------------
    // DI Method (setter,getter) Declaration
    // ---------------------------------------------------------------------
    // ---------------------------------------------------------------------
    // this Method (public/private) Declaration
    // ---------------------------------------------------------------------
	
	public static String getConcatFilePath (String path,String pathPattern,String file) {
		String returnValue ;
		returnValue = path;
		if(returnValue.length() == (returnValue.lastIndexOf(pathPattern)+1)){
			returnValue+=file;
		}else {
			returnValue +=pathPattern+file;
		}
		
		return returnValue;
	}
	
	public static void main (String [] a) {
		System.out.println(getConcatFilePath("c:/log", "/", "20101010.log"));
	}
    // ---------------------------------------------------------------------
    // interface implement Method (public/private) Declaration
    // ---------------------------------------------------------------------
    // ---------------------------------------------------------------------
    // abstract implement Method (public/private) Declaration
    // ---------------------------------------------------------------------
    // ---------------------------------------------------------------------
    // abstract Method (public/private) Declaration
    // ---------------------------------------------------------------------
}
